Easy2Siksha.com
• Funky(2) returns 2 × 1 = 2
• Funky(3) returns 3 × 2 = 6
• Funky(4) returns 4 × 6 = 24
• Funky(5) returns 5 × 24 = 120
And just like that, the factorial of 5 is found through recursion!
Why is Recursion Special?
Recursion is like a superpower in programming. It helps us solve complex problems in a neat,
elegant way, especially when the problem can be broken down into similar smaller problems
— like tree structures, puzzles, or mathemacal series.
But just like magic, recursion should be used carefully. Without a base case, it would go on
forever — like falling into an endless mirror loop!
Final Words
So, whenever you hear the word recursion, think of a team of helpers, each solving a smaller
task and passing the answer back — like a relay race. And when used right, it makes
problems like factorials, Fibonacci numbers, tower of Hanoi, and more look like child’s play!
Next me you see a big problem, don’t panic. Just ask yourself,
“Can I solve a smaller version of this and build up to the full answer?”
That’s the recursive way — small steps, big soluons.
SECTION-D
7. What is structure in C? Which are types of structures ? Explain the uses of structures:
Give an example.
Ans: In that classroom, there’s a teacher named Mr. Sharma, who is known for his unique
way of taking aendance. Instead of calling names and checking roll numbers from a
register, he maintains a separate notebook for each student with their name, roll number,
marks, and grade. Every me he checks aendance, he opens a student’s notebook and sees
all the informaon together.
Now imagine if Mr. Sharma had to keep four dierent registers — one for names, one for roll
numbers, one for marks, and one for grades. That would be confusing, right?
This is exactly what structures in C solve.